package com.problem.leetcode;

/**
 * @author didi
 * @DESCRIPTION
 * @create 2019-04-25 22:26
 **/

public class Problem520 {
    public boolean detectCapitalUse(String word) {
        for (int index = 0; index < word.length() - 1; index++) {
            if (index == 0) {
                if (Character.isLowerCase(word.charAt(index)) && Character.isUpperCase(word.charAt(index + 1))) {
                    return false;
                }
            } else {
                if ((Character.isLowerCase(word.charAt(index)) && Character.isUpperCase(word.charAt(index + 1))) ||
                    (Character.isUpperCase(word.charAt(index)) && Character.isLowerCase(word.charAt(index + 1)))) {
                    return false;
                }
            }
        }
        return true;
    }
}
